package cn.com.xiaoshoujia.order.activity;

import cn.com.xiaoshoujia.activities.dto.*;
import cn.com.xiaoshoujia.activities.mapper.ActivityMapper;
import cn.com.xiaoshoujia.activities.vo.ActivitiyBackMsgVO;
import cn.com.xiaoshoujia.application.service.WalletService;
import cn.com.xiaoshoujia.company.entity.ComAccountLog;
import cn.com.xiaoshoujia.company.mapper.ComAccountLogMapper;
import cn.com.xiaoshoujia.constants.*;
import cn.com.xiaoshoujia.domain.dto.WalletLogsDTO;
import cn.com.xiaoshoujia.infrastructure.utils.Result;
import cn.com.xiaoshoujia.order.entity.ActivityOrder;
import cn.com.xiaoshoujia.order.entity.Order;
import cn.com.xiaoshoujia.order.mapper.ActivityOrderMapper;
import cn.com.xiaoshoujia.order.mapper.OrderMapper;
import cn.com.xiaoshoujia.quartz.wx.TeamHeadQuartz;
import cn.com.xiaoshoujia.user.entity.*;
import cn.com.xiaoshoujia.user.mapper.*;
import cn.com.xiaoshoujia.utils.PayUtil;
import cn.com.xiaoshoujia.wallet.entity.ErrorLogs;
import cn.com.xiaoshoujia.wallet.mapper.ErrorLogsMapper;
import org.quartz.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Calendar;

@Repository
public class OrderActivity {

    Logger logger = LoggerFactory.getLogger(OrderActivity.class);

    @Resource(name = "schedulerFactoryBean")
    private Scheduler scheduler;

    public static String dateFormate = "ss mm HH dd MM ? yyyy";
    public static SimpleDateFormat cronSdf = new SimpleDateFormat(dateFormate);

    @Autowired
    private OrderMapper orderMapper;

    @Autowired
    private ActivityMapper activityMapper;

    @Autowired
    private ActivityCluesMapper activityCluesMapper;

    @Autowired
    private ActivityTeamSingleMapper activityTeamSingleMapper;

    @Autowired
    private ActivityTeamHeadMapper activityTeamHeadMapper;

    @Autowired
    private ActivityJoinMapper activityJoinMapper;

    @Autowired
    private ActivityOrderMapper activityOrderMapper;

    @Autowired
    private ComAccountLogMapper comAccountLogMapper;

    @Autowired
    private UserAccountLogMapper userAccountLogMapper;

    @Autowired
    WalletService walletService;

    @Autowired
    ErrorLogsMapper errorLogsMapper;

    @Autowired
    private ShareUserMapper shareUserMapper;

    /*--------------------wx start--------------------*/

    /**
     * @Author: yangrui
     * @Description:保存订单
     * @Date: 下午4:13 2017/8/3
     */
    public boolean save(Order order) {
        Date date = new Date();
        order.setOrderId(PayUtil.getOrderId());
        order.setCreateTime(date);
        return orderMapper.save(order) > 0;
    }

    /**
     * @Author: dulei
     * @Description: 保存开团订单
     * @Date: 2017/8/7 16:55
     */
    public boolean saveHeadOrder(ActivityOrderWxDTO wxOrder, Long productId) throws RuntimeException {
        Object obj = activityOrderMapper.teamNoPay(wxOrder.getSysId(), wxOrder.getId(), 0);
        if (null != obj) {
            logger.info("submit again");
            return false;
        }
        logger.info("head get ActivityWxDTO");
        ActivityWxDTO activityWxDTO = (ActivityWxDTO) activityMapper.findWxActivitiesById(wxOrder.getId());
        if (!activityWxDTO.getDiscountPrice().equals(wxOrder.getPrice())) {
            logger.info("two price is not equal");
            return false;
        }
        ActivityClues activityClues = activityCluesInstance(wxOrder, activityWxDTO.getFkCompanyXcode(), productId);

        logger.info("head create ActivityTeamHead");
        ActivityTeamHead activityTeamHead = new ActivityTeamHead(wxOrder.getId(), wxOrder.getUserName(), 0, new Date());
        ActivityJoin activityJoin = new ActivityJoin(wxOrder.getSysId(), null, wxOrder.getId(), 1, new Date(), null);

        if (activityCluesMapper.save(activityClues) != 1) {
            logger.info("save clues fail");
            throw new RuntimeException("save clues fail");
        }
        if (activityTeamHeadMapper.save(activityTeamHead) != 1) {
            logger.info("save head fail");
            throw new RuntimeException("save head fail");
        }
        Order order = new Order(wxOrder.getId(), 0, activityTeamHead.getId(), wxOrder.getSysId(), activityWxDTO.getDiscountPrice(), 0, productId, activityClues.getId());
        boolean save = save(order);
        if (!save) {
            logger.info("save order fail");
            throw new RuntimeException("save order fail");
        }
        activityJoin.setHeadId(activityTeamHead.getId());
        activityJoin.setOrderId(order.getOrderId());
        if (activityJoinMapper.save(activityJoin) != 1) {
            logger.info("save join fail");
            throw new RuntimeException("save head join fail");
        }
        /*钱包服务 start*/
        String fkCompanyXcode = activityWxDTO.getFkCompanyXcode();
        try {
            Result result1 = walletService.findByXcode(fkCompanyXcode);
            //企业未绑定钱包
            if ("false".equals(result1.getCode())) {
                //绑定钱包
                Result result2 = walletService.save(fkCompanyXcode);
                if ("FAIL".equals(result2.getCode())) {
                    logger.error("拼团预付 {}", result2.getObject().toString());
                    throw new RuntimeException(result2.getObject().toString());
                }
            }
        } catch (Exception e) {
            logger.error(e.toString());
        }
        WalletLogsDTO walletLogsDTO = new WalletLogsDTO();
        walletLogsDTO.setOpeartor(wxOrder.getSysId());
        walletLogsDTO.setOpeartorType(1);
        walletLogsDTO.setType(1);
        walletLogsDTO.setFkCompanyXcode(fkCompanyXcode);
        walletLogsDTO.setPrice(activityWxDTO.getDiscountPrice());
        walletLogsDTO.setOrderId(order.getOrderId());
        walletLogsDTO.setBillingType(BillingTypeEnum.INCOME.getCode());
        walletLogsDTO.setBusinessType(BusinessTypeEnum.TRANSACTION.getCode());
        walletLogsDTO.setFundsFrom(FundsFromEnum.PERSONAL_WECHAT.getCode());
        walletLogsDTO.setFundsTo(FundsToEnum.FUNDS_POOL.getCode());
        walletLogsDTO.setScene(Scene.TEAM_HEAD.getCode());
        try {
            Result result3 = walletService.saveWalletLogs(walletLogsDTO);
            if ("FAIL".equals(result3.getCode())) {
                logger.error("拼团预付 {}", result3.getObject().toString());
                throw new RuntimeException(result3.getObject().toString());
            }
        } catch (Exception e) {
            logger.error(e.toString());
            ErrorLogs errorLogs = new ErrorLogs();
            BeanUtils.copyProperties(walletLogsDTO, errorLogs);
            errorLogs.setCreateTime(new Date());
            int i = errorLogsMapper.save(errorLogs);
            if (i != 1) {
                logger.error("拼团单买 插入异常日志有误");
            }
        }
        /*钱包服务 end*/
        return true;


    }

    /**
     * @Author: dulei
     * @Description: 保存参团订单
     * @Date: 2017/8/7 16:55
     */
    public boolean saveJoinOrder(ActivityOrderWxDTO wxOrder, Long productId) throws RuntimeException {
        ActivityTeamHead wxHeadById = activityTeamHeadMapper.findWxHeadById(wxOrder.getHeadId());
        if (null == wxHeadById) {
            logger.info("no head");
            return false;
        }
        if (wxHeadById.getStatus().intValue() == 3) {
            logger.info("team status 3");
            return false;
        }
        Object obj = activityOrderMapper.teamNoPay(wxOrder.getSysId(), wxOrder.getId(), 0);
        if (null != obj) {
            logger.info("submit again");
            return false;
        }
        logger.info("join get ActivityWxDTO");
        ActivityWxDTO activityWxDTO = (ActivityWxDTO) activityMapper.findWxActivitiesById(wxOrder.getId());
        if (!activityWxDTO.getDiscountPrice().equals(wxOrder.getPrice())) {
            logger.info("two price is not equal");
            return false;
        }
        ActivityClues activityClues = activityCluesInstance(wxOrder, activityWxDTO.getFkCompanyXcode(), productId);

        logger.info("join create ActivityJoin");
        ActivityJoin activityJoin = new ActivityJoin(wxOrder.getSysId(), wxOrder.getHeadId(), wxOrder.getId(), 0, new Date(), null);

        if (activityCluesMapper.save(activityClues) != 1) {
            logger.info("save clues fail");
            throw new RuntimeException("save clues fail");
        }
        logger.info("join save order");
        Order order = new Order(wxOrder.getId(), 0, wxOrder.getHeadId(), wxOrder.getSysId(), activityWxDTO.getDiscountPrice(), 0, productId, activityClues.getId());
        boolean save = save(order);
        if (!save) {
            logger.info("save order fail");
            throw new RuntimeException("save order fail");
        }
        activityJoin.setOrderId(order.getOrderId());
        if (activityJoinMapper.save(activityJoin) != 1) {
            logger.info("save join fail");
            throw new RuntimeException("save head join fail");
        }
        logger.info("single save order");
        /*钱包服务 start*/
        String fkCompanyXcode = activityWxDTO.getFkCompanyXcode();
        try {
            Result result1 = walletService.findByXcode(fkCompanyXcode);
            //企业未绑定钱包
            if ("false".equals(result1.getCode())) {
                //绑定钱包
                Result result2 = walletService.save(fkCompanyXcode);
                if ("FAIL".equals(result2.getCode())) {
                    logger.error("拼团预付 {}", result2.getObject().toString());
                    throw new RuntimeException(result2.getObject().toString());
                }
            }
        } catch (Exception e) {
            logger.error(e.toString());
        }
        WalletLogsDTO walletLogsDTO = new WalletLogsDTO();
        walletLogsDTO.setOpeartor(wxOrder.getSysId());
        walletLogsDTO.setOpeartorType(1);
        walletLogsDTO.setType(1);
        walletLogsDTO.setFkCompanyXcode(fkCompanyXcode);
        walletLogsDTO.setPrice(activityWxDTO.getDiscountPrice());
        walletLogsDTO.setOrderId(order.getOrderId());
        walletLogsDTO.setBillingType(BillingTypeEnum.INCOME.getCode());
        walletLogsDTO.setBusinessType(BusinessTypeEnum.TRANSACTION.getCode());
        walletLogsDTO.setFundsFrom(FundsFromEnum.PERSONAL_WECHAT.getCode());
        walletLogsDTO.setFundsTo(FundsToEnum.FUNDS_POOL.getCode());
        walletLogsDTO.setScene(Scene.TEAM_HEAD.getCode());
        try {
            Result result3 = walletService.saveWalletLogs(walletLogsDTO);
            if ("FAIL".equals(result3.getCode())) {
                logger.error("拼团预付 {}", result3.getObject().toString());
                throw new RuntimeException(result3.getObject().toString());
            }
        } catch (Exception e) {
            logger.error(e.toString());
            ErrorLogs errorLogs = new ErrorLogs();
            BeanUtils.copyProperties(walletLogsDTO, errorLogs);
            errorLogs.setCreateTime(new Date());
            int i = errorLogsMapper.save(errorLogs);
            if (i != 1) {
                logger.error("拼团单买 插入异常日志有误");
            }
        }
        /*钱包服务 end*/
        return true;
    }

    public Integer findWxHeadStatus(Long headId) {
        return activityTeamHeadMapper.findWxHeadStatus(headId);
    }

    /**
     * @Author: dulei
     * @Description: 保存单买订单
     * @Date: 2017/8/7 16:55
     */
    public boolean saveSingleOrder(ActivityOrderWxDTO wxOrder, Long productId) {
        logger.info("single get ActivityWxDTO");
        ActivityWxDTO activityWxDTO = (ActivityWxDTO) activityMapper.findWxActivitiesById(wxOrder.getId());
        if (!activityWxDTO.getPrice().equals(wxOrder.getPrice())) {
            logger.info("two price is not equal");
            return false;
        }
        ActivityClues activityClues = activityCluesInstance(wxOrder, activityWxDTO.getFkCompanyXcode(), productId);
        logger.info("single create ActivityTeamSingle");
        ActivityTeamSingle teamSingle = new ActivityTeamSingle(wxOrder.getId(), 0, new Date());
        if (activityCluesMapper.save(activityClues) != 1) {
            logger.info("save clues fail");
            throw new RuntimeException("save clues fail");
        }
        if (activityTeamSingleMapper.save(teamSingle) != 1) {
            logger.info("save single fail");
            throw new RuntimeException("save single fail");
        }
        logger.info("single save order");
        Order order = new Order(wxOrder.getId(), 1, teamSingle.getId(), wxOrder.getSysId(), activityWxDTO.getPrice(), 0, productId, activityClues.getId());
        boolean save = save(order);
        if (!save) {
            logger.info("save order fail");
            throw new RuntimeException("save order fail");
        }
        /*钱包服务 start*/
        String fkCompanyXcode = activityWxDTO.getFkCompanyXcode();
        try {
            Result result1 = walletService.findByXcode(fkCompanyXcode);
            //企业未绑定钱包
            if ("false".equals(result1.getCode())) {
                //绑定钱包
                Result result2 = walletService.save(fkCompanyXcode);
                if ("FAIL".equals(result2.getCode())) {
                    logger.error("拼团单买 {}", result2.getObject().toString());
                    throw new RuntimeException(result2.getObject().toString());
                }
            }
        } catch (Exception e) {
            logger.error(e.toString());
        }

        WalletLogsDTO walletLogsDTO = new WalletLogsDTO();
        walletLogsDTO.setOpeartor(wxOrder.getSysId());
        walletLogsDTO.setOpeartorType(1);
        walletLogsDTO.setType(0);
        walletLogsDTO.setFkCompanyXcode(fkCompanyXcode);
        walletLogsDTO.setPrice(activityWxDTO.getPrice());
        walletLogsDTO.setOrderId(order.getOrderId());
        walletLogsDTO.setBillingType(BillingTypeEnum.INCOME.getCode());
        walletLogsDTO.setBusinessType(BusinessTypeEnum.TRANSACTION.getCode());
        walletLogsDTO.setFundsFrom(FundsFromEnum.PERSONAL_WECHAT.getCode());
        walletLogsDTO.setFundsTo(FundsToEnum.BALANCE.getCode());
        walletLogsDTO.setScene(Scene.TEAM_SINGLE.getCode());
        try {
            Result result3 = walletService.saveWalletLogs(walletLogsDTO);
            if ("FAIL".equals(result3.getCode())) {
                logger.error("拼团单买 {}", result3.getObject().toString());
                throw new RuntimeException(result3.getObject().toString());
            }
        } catch (Exception e) {
            logger.error(e.toString());
            ErrorLogs errorLogs = new ErrorLogs();
            BeanUtils.copyProperties(walletLogsDTO, errorLogs);
            errorLogs.setCreateTime(new Date());
            int i = errorLogsMapper.save(errorLogs);
            if (i != 1) {
                logger.error("拼团单买 插入异常日志有误");
            }
        }
        /*钱包服务 end*/
        return true;
    }

    private ActivityClues activityCluesInstance(ActivityOrderWxDTO wxDTO, String xcode, Long productId) {
        ActivityClues instance = new ActivityClues(null, xcode, wxDTO.getId(), wxDTO.getSysId(), wxDTO.getCluesPhone(), wxDTO.getUserName(), new Date(),
                wxDTO.getValueJson(), 10, null, new Date(), (byte) 1, productId);
        if (wxDTO.getSysId() != null) {
            ShareUser shareUser = shareUserMapper.getBySysId(wxDTO.getSysId());
            logger.debug("获取到用户 {} 的信息",shareUser.getShareName());
            instance.setHeadImg(shareUser.getImgUrl());
            instance.setUserNickname(shareUser.getShareName());
        }
        return instance;
    }

    public Order findByOrderId(String orderId) {
        return orderMapper.findByOrderId(orderId);
    }

    public boolean saveLog(String total_fee) {
        return true;
    }

    @Transactional
    public boolean notifyProcess(String orderId, String total_fee, String cluesId) {
        Order order = orderMapper.findByOrderId(orderId);
        if (order == null) {
            logger.error("wx 订单不存在");
            return false;
        }
        Boolean aBoolean = String.valueOf(order.getPrice().multiply(BigDecimal.valueOf(100)).intValue()).equals(total_fee);
        if (!aBoolean) {
            logger.error("wx 金额不同");
            return false;
        }
        order.setStatus(1);
        int i = orderMapper.update(order);
        if (i > 0) {
            ActivitiyBackMsgVO activitiyBackMsg = activityOrderMapper.notifyMsg(orderId);
            if (order.getType().intValue() == 1) {
                logger.info("single type");
                ActivityTeamSingle activityTeamSingle = new ActivityTeamSingle(order.getTeamId(), new Date());
                activityTeamSingle.setStatus(1);
                logger.info("update single status");
                int count = activityTeamSingleMapper.updateStatus(activityTeamSingle);
                if (count == 0) {
                    logger.error("wx updateSingle{}", "系统异常");
                    throw new RuntimeException("系统异常");
                }
            } else {
                logger.info("get join msg");
                ActivityWxJoinDTO activityJoin = (ActivityWxJoinDTO) activityJoinMapper.findBySysIdTeamId(order.getTeamId(), order.getSysId(), orderId);
                logger.info("get call back msg");
                if (activityJoin.getType().intValue() == 1) {
                    logger.info("head type");
                    Date date = new Date();
                    logger.info("update head status");
                    int count = activityTeamHeadMapper.updateWxStatus(new ActivityTeamHead(order.getTeamId(), 1, date, null));
                    if (count == 1) {
                        /*定时器 start*/
                        logger.info("team wx quartz");
                        String name = String.valueOf(System.currentTimeMillis());
                        String jobName = "teamHeadJob" + name;
                        String triggerName = "teamHeadTrigger" + name;
                        logger.info("team wx quartz jobName {}", jobName);
                        logger.info("team wx quartz triggerName {}", triggerName);
                        Long teamId = order.getTeamId();
                        logger.info("team wx quartz teamId {}", teamId);
                        int hour = activitiyBackMsg.getTimeLimit();

//                        int hour = 300;  //测试30秒
                        JobKey jobKey = JobKey.jobKey(jobName, "teamHeadGroup");
                        JobDetail job = JobBuilder.newJob(TeamHeadQuartz.class).withIdentity(jobKey).usingJobData("jobName", jobName).usingJobData("teamId", teamId).build();
                        Calendar rightNow = Calendar.getInstance();
                        rightNow.setTime(date);
                        /*测试*/
//                        rightNow.add(Calendar.SECOND, hour);//日期加10秒
                        rightNow.add(Calendar.HOUR, hour);
                        Trigger trigger = TriggerBuilder.newTrigger().withIdentity(triggerName, "teamHeadGroup")
                                .withSchedule(CronScheduleBuilder.cronSchedule(cronSdf.format(rightNow.getTime())))
                                .build();
                        try {
                            scheduler.scheduleJob(job, trigger);
                            scheduler.start();
                            logger.info("team wx quartz start");
                        } catch (SchedulerException e) {
                            logger.error("team wx quartz error {}", e.toString());
                        }
                        /*定时器 end*/
                    } else {
                        logger.error("wx head throw", "系统异常");
                        throw new RuntimeException("系统异常");
                    }
                }
                logger.info("get order count");
                ActivityOrderCountDTO orderCount = (ActivityOrderCountDTO) activityOrderMapper.findOrderCount(order.getTeamId());
                logger.info("orderCount successCount =" + orderCount.getSuccessCount() + ";count = " + orderCount.getCount(), orderCount.getSuccessCount());
                if (orderCount.getSuccessCount().intValue() == activitiyBackMsg.getParticipants().intValue()) {
                    ActivityTeamHead activityTeamHead = new ActivityTeamHead(order.getTeamId(), 3, null, new Date());
                    int count = activityTeamHeadMapper.updateWxStatus(activityTeamHead);
                    if (count != 1) {
                        logger.error("wx head throw status 3", "系统异常");
                        throw new RuntimeException("系统异常");
                    }
                } else {
                    if (orderCount.getCount().intValue() >= activitiyBackMsg.getParticipants().intValue() && activityJoin.getStatus().intValue() == 1) {
                        ActivityTeamHead activityTeamHead = new ActivityTeamHead(order.getTeamId(), 2, null, null);
                        int count = activityTeamHeadMapper.updateWxStatus(activityTeamHead);
                        if (count != 1) {
                            logger.error("wx head throw status 2", "系统异常");
                            throw new RuntimeException("系统异常");
                        }
                    }
                }
            }
            BigDecimal amount = new BigDecimal(total_fee).divide(BigDecimal.valueOf(100));
            ComAccountLog comAccountLog = new ComAccountLog(null, activitiyBackMsg.getComId(), (byte) 6, orderId,
                    amount, activitiyBackMsg.getProductName(), activitiyBackMsg.getFkBsProductId(), (byte) 1, new Date(),
                    (byte) 1, 1, activitiyBackMsg.getUserName(), "拼团活动", (byte) 30);
            comAccountLogMapper.save(comAccountLog);
            UserAccountLog userAccountLog = new UserAccountLog(null, activitiyBackMsg.getSysId(), (byte) 1, (byte) 2,
                    activitiyBackMsg.getId(), amount.multiply(BigDecimal.valueOf(-1)), activitiyBackMsg.getProductName(),
                    activitiyBackMsg.getFkBsProductId(), new Date(), (byte) 1, (byte) 30);
            userAccountLogMapper.save(userAccountLog);
        }
        if (i == 0) {
            logger.error("wx notifyProcess{}", "系统异常");
            throw new RuntimeException("系统异常");
        }
        return true;
    }

    public ActivityClues findCluesByOrderId(String orderId) {
        return activityCluesMapper.findCluesByOrderId(orderId);
    }

    /**
     * @Author: dulei
     * @Description: 取消订单
     * @Date: 2017/8/9 9:08
     */
    public boolean cancelOrder(String orderId) throws RuntimeException {

        ActivityOrder activityOrder = activityOrderMapper.findByOrderId(orderId);
        if (null == activityOrder) {
            logger.info("not order");
            return false;
        }
        logger.info("update order");
        Order order = new Order();
        order.setOrderId(orderId);
        order.setStatus(-1);
        int orderCout = orderMapper.update(order);
        if (orderCout != 1) {
            logger.error("update single order error");
            throw new RuntimeException("update single order error");
        }
        if (activityOrder.getType().intValue() == 1) {
            logger.info("update single");
            ActivityTeamSingle activityTeamSingle = new ActivityTeamSingle(activityOrder.getTeamId(), new Date());
            activityTeamSingle.setStatus(2);
            int status = activityTeamSingleMapper.updateStatus(activityTeamSingle);
            if (status != 1) {
                logger.error("update single error");
                throw new RuntimeException("update single error");
            }
            return true;
        }
        logger.info("get join type");
        Integer type = activityJoinMapper.findType(activityOrder.getTeamId(), activityOrder.getSysId(), orderId);
        if (type.intValue() == 1) {
            ActivityTeamHead activityTeamHead = new ActivityTeamHead(activityOrder.getTeamId(), -1, null, new Date());
            int count = activityTeamHeadMapper.updateWxStatus(activityTeamHead);
            if (count != 1) {
                logger.error("update head error");
                throw new RuntimeException("update head error");
            }
        }
        return true;
    }

    public ActivityCluesMsgDTO findTypeByOrderId(String orderId) {
        return (ActivityCluesMsgDTO) activityOrderMapper.findTypeByOrderId(orderId);
    }

    public Map<String, Object> findNoPayOrder(String sysId, Long id) {
        Map<String, Object> map = new HashMap<>();
        List<ActivityOrder> orders = activityOrderMapper.findAllNoPay(sysId, id);
        if (orders.size() == 0) {
            map.put("orderId", null);
            map.put("type", null);
        } else if (orders.size() == 1) {
            map.put("orderId", orders.get(0).getOrderId());
            map.put("type", orders.get(0).getType());
        } else {
            logger.error("用户有多于1个未支付订单 sysId = {},id = {}", sysId, id);
            map.put("orderId", orders.get(0).getOrderId());
            map.put("type", orders.get(0).getType());
        }
        return map;
    }

    /**
     * @Author: yangrui
     * @Description:
     * @Date: 下午2:49 2017/8/31
     */
    public List<String> findByTeamId(Long teamId) {
        return orderMapper.findByTeamId(teamId);
    }
    /*--------------------wx end--------------------*/
}
